/*package com.hy.mydesktop.client.component.factory;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import org.eclipse.jdt.internal.compiler.lookup.MostSpecificExceptionMethodBinding;

import com.extjs.gxt.samples.resources.client.Resources;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.data.BaseListLoadResult;
import com.extjs.gxt.ui.client.data.BaseListLoader;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.BasePagingLoader;
import com.extjs.gxt.ui.client.data.ListLoader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.extjs.gxt.ui.client.data.PagingLoader;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.dnd.DND.Feedback;
import com.extjs.gxt.ui.client.dnd.GridDragSource;
import com.extjs.gxt.ui.client.dnd.GridDropTarget;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.GridEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.GroupingStore;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
import com.extjs.gxt.ui.client.widget.grid.RowEditor;
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
import com.extjs.gxt.ui.client.widget.menu.MenuBarItem;
import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.test.client.component.meta.AbstractComponetModelEnum;
import com.test.client.component.meta.GridModelEnum;
import com.test.client.component.meta.GridSetModulesEnum;
import com.test.client.component.meta.GxtComponentMetaNodeModel;
import com.test.client.rpc.GreetingService;
import com.test.client.rpc.GreetingServiceAsync;
import com.test.client.rpc.ServiceInvoker;
import com.test.client.rpc.ServiceInvokerAsync;
import com.test.client.rpc.reader.GxtToSeamServiceResultGridColumnModelReader;
import com.test.client.rpc.reader.GxtToSeamServiceResultListReader;
import com.test.client.rpcModel.RPCBaseModel;
import com.test.shared.rpc.meta.GxtToSeamServiceParameter;
import com.test.shared.rpc.meta.GxtToSeamServiceResult;

*//**
 * 
 * <ul>
 * <li>开发作者：冬超</li>
 * <li>设计日期：2010-8-30；时间：下午01:11:56</li>
 * <li>类型名称：ReorderingGridFactory</li>
 * <li>设计目的：</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 *//*
public class GridModuleFactory2 {

	// 表格字段集合
	private static List<ColumnConfig> configs;
	// 表格的渲染
	private static GridCellRenderer<BaseModel> ageRender;
	*//**
	 *  拖动
	 *//*
	private static GridDropTarget dropTarget;
	// 后天交互
	private static RpcProxy<List<BaseModel>> proxy;
	// 字段模型
	private static ColumnModel cm;
	// 面板
	private static ContentPanel contentPanel;
	// 调用后台的程序
	private static GreetingServiceAsync service = GWT.create(GreetingService.class);
	//private static ServiceInvokerAsync serviceInvoker = GWT.create(ServiceInvoker.class);
	// 后台加载的数据loader
	private static ListLoader<BaseListLoadResult<BaseModel>> loader;

//	private static PagingLoader<PagingLoadResult<BaseModel>> pagingLoader;
	private static PagingLoader<PagingLoadResult<ModelData>> pagingLoader;
	
	*//**
	 * 行号
	 *//*
	private static RowNumberer numberer;

	public static ContentPanel GridModule(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {

		return configureGridModule(gxtComponentMetaNodeModel);

	}

	*//**
	 * 
	 * 
	 * @param gxtComponentMetaNodeModel
	 * @return
	 *//*
	private static ContentPanel configureGridModule(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {
		// version需要先赋值

		contentPanel = ContentPanelFactory
		.createContentPanel(gxtComponentMetaNodeModel);
		//contentPanel.setAutoWidth(true);
		Grid<ModelData> grid = createDefaultBaseGrid(
				//版本：设置是哪一类的表格
				(Integer) gxtComponentMetaNodeModel.get(GridModelEnum.VERSION
						.name().toLowerCase()), 
						//元模型
						gxtComponentMetaNodeModel,
						contentPanel);
		
		grid.setAutoWidth(true);
		grid.setStripeRows(true);
		grid.setHeight(100);
	   // grid.setColumnLines(true);   
	   // grid.setColumnReordering(true); 
		//grid.setAutoHeight(true);
		grid = AbstractComponetFactory.configureAbstractComponet(grid, gxtComponentMetaNodeModel);
		AbstractComponetFactory.configureGxtToSeamServiceParameterModel(grid, gxtComponentMetaNodeModel);

		
		
		
		//TODO 字段加载相关
		if (gxtComponentMetaNodeModel.get(GridModelEnum.COLUMNCONFIGLOAD.name()
				.toLowerCase()) != null) {
			Object object = gxtComponentMetaNodeModel
					.get(GridModelEnum.COLUMNCONFIGLOAD.name().toLowerCase());
			grid.setData("columnConfigLoad", object);
			

		}
		//TODO 数据加载相关
		if (gxtComponentMetaNodeModel.get(GridModelEnum.DATALOAD.name()
				.toLowerCase()) != null) {
			Object object = gxtComponentMetaNodeModel
					.get(GridModelEnum.DATALOAD.name().toLowerCase());
			grid.setData("dataLoad", object);

		}
		// 高度
		if (gxtComponentMetaNodeModel.get(GridModelEnum.HIGHT.name()
				.toLowerCase()) != null) {
			Integer height = (Integer) gxtComponentMetaNodeModel
					.get(GridModelEnum.HIGHT.name().toLowerCase());
			grid.setHeight((int) height);

		}
		
		// 宽度
		if (gxtComponentMetaNodeModel.get(GridModelEnum.WIDTH.name()
				.toLowerCase()) != null) {
			Integer width = (Integer) gxtComponentMetaNodeModel
					.get(GridModelEnum.WIDTH.name().toLowerCase());
			grid.setWidth((int) width);

		}
		//自动调整宽度
		if (gxtComponentMetaNodeModel.get(GridSetModulesEnum.AUTOWIDTH.name()
				.toLowerCase()) != null) {
			boolean autoWidth=(Boolean)gxtComponentMetaNodeModel.get(GridSetModulesEnum.AUTOWIDTH.name()
					.toLowerCase());
			grid.setAutoWidth(autoWidth);
		}
		//自动调整高度
		if (gxtComponentMetaNodeModel.get(GridSetModulesEnum.AUTOHEIGHT.name()
				.toLowerCase()) != null) {
			boolean autoHeight=(Boolean)gxtComponentMetaNodeModel.get(GridSetModulesEnum.AUTOHEIGHT.name()
					.toLowerCase());
			grid.setAutoHeight(autoHeight);

		}
		//设置字段宽度是否可调整
		if (gxtComponentMetaNodeModel.get(GridModelEnum.ENABLECOLUMNRESIZE
				.name().toLowerCase()) != null) {
			Boolean enableColumnResize = (Boolean) gxtComponentMetaNodeModel
					.get(GridModelEnum.ENABLECOLUMNRESIZE.name().toLowerCase());
			grid.setEnableColumnResize(enableColumnResize);

		}
		//设置最小字段宽度
		if (gxtComponentMetaNodeModel.get(GridModelEnum.MINCOLUMNWIDTH.name()
				.toLowerCase()) != null) {
			Integer minColumnWidth = (Integer) gxtComponentMetaNodeModel
					.get(GridModelEnum.MINCOLUMNWIDTH.name().toLowerCase());
			grid.setMinColumnWidth(minColumnWidth);

		}
		//设置自动扩张的字段
		if (gxtComponentMetaNodeModel.get(GridModelEnum.AUTOEXPANDCOLUMN.name()
				.toLowerCase()) != null) {
			String autoColumn = (String) gxtComponentMetaNodeModel
					.get(GridModelEnum.AUTOEXPANDCOLUMN.name().toLowerCase());
			grid.setAutoExpandColumn(autoColumn);

		}
		//设置是否高亮显示，选中的数据
		if (gxtComponentMetaNodeModel.get(GridModelEnum.TRACKMOUSEOVER.name()
				.toLowerCase()) != null) {
			Boolean trackMouseOver = (Boolean) gxtComponentMetaNodeModel
					.get(GridModelEnum.TRACKMOUSEOVER.name().toLowerCase());
			grid.setTrackMouseOver(trackMouseOver);

		}
		//设置是否显示边框
		if (gxtComponentMetaNodeModel.get(GridModelEnum.BORDER.name()
				.toLowerCase()) != null) {
			Boolean show = (Boolean) gxtComponentMetaNodeModel
					.get(GridModelEnum.BORDER.name().toLowerCase());
			grid.setBorders(show);

		}
		
		
		//设置单元格，可编辑的样式：是行可编辑样式
		if (gxtComponentMetaNodeModel.get(GridModelEnum.ROEWEDIT.name()
				.toLowerCase()) != null) {
			RowEditor<ModelData> editor = new RowEditor<ModelData>();
			grid.addPlugin(editor);
		}
		
		
		
		//设置表格可拖动
		if (gxtComponentMetaNodeModel.get(GridModelEnum.REODRDER.name()
				.toLowerCase()) != null) {
			new GridDragSource(grid);
			  
			dropTarget = new GridDropTarget(grid);
			dropTarget.setAllowSelfAsSource(true);  
		}
		
		//与可拖动配合使用（见上）必须配合使用
		if (gxtComponentMetaNodeModel.get(GridModelEnum.FEEBACK.name()
				.toLowerCase()) != null) {
			//设置TreeGrid的内部结构的，拖动改变
			String back = ((String) gxtComponentMetaNodeModel
					.get(GridModelEnum.FEEBACK.name().toLowerCase()))
					.toUpperCase();
			if (back.equals("APPEND")) {
				dropTarget.setFeedback(Feedback.APPEND);
			} else if (back.equals("BOTH")) {
				dropTarget.setFeedback(Feedback.BOTH);
			} else {
				dropTarget.setFeedback(Feedback.INSERT);
			}

		}
		
		//是表格，可以显示行号（需要）		
		if (gxtComponentMetaNodeModel.get(GridModelEnum.ROWNUMBER.name()
				.toLowerCase()) != null) {		
				RowNumberer showRowNumberer = new RowNumberer();
				showRowNumberer.setWidth(20);
				configs.add(0,showRowNumberer);
				grid.addPlugin(showRowNumberer);
			grid.setData("showRowNumberer", true);
			
		}
		
		
		
		//分组表格的设置
		if (gxtComponentMetaNodeModel.get(GridModelEnum.GROUPINGVIEW.name()
				.toLowerCase()) != null) {
			grid.setData("groupingView", true);
			GroupingView view = new GroupingView();
			view.setShowGroupedColumn(false);
			view.setForceFit(true);
			String f = (String)(gxtComponentMetaNodeModel.get(GridModelEnum.GROUPINGCOLUMNID.name().toLowerCase()));
			if (f==null) {
				f="Grouping";
			}
			final String ff = f;
			grid.setData("groupingColumnId",ff);
			//分组表格中，一个分组内的表头信息
			view.setGroupRenderer(new GridGroupRenderer() {
				public String render(GroupColumnData data) {
//					String f = cm.getColumnById(data.field).getHeader();
					String l = data.models.size() == 1 ? "Item" : "Items";
					return ff + ": " + data.group + " (" + data.models.size()
							+ " " + l + ")";
					
				}
			});
			grid.setView(view);
		}
		
		//？？拖动相关
		if (gxtComponentMetaNodeModel.get(GridModelEnum.AllOWSELFASSOURCE
				.name().toLowerCase()) != null) {
			Boolean allowSelfAsSource = (Boolean) gxtComponentMetaNodeModel
					.get(GridModelEnum.AllOWSELFASSOURCE.name().toLowerCase());
			dropTarget.setAllowSelfAsSource(allowSelfAsSource);
		}

		return contentPanel;
	}

	private static Grid<ModelData> createDefaultBaseGrid(int version,
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel,ContentPanel contentPanel) {
		//gxtComponentMetaNodeModel，可能会使contentPanel可能和grid重合，混淆
		
		ListStore<ModelData> employeeStore;
		GroupingStore<ModelData> groupStore;
		ListStore<ModelData> pagingStore;
			
		configs = new ArrayList<ColumnConfig>();
		//configs.add(new ColumnConfig());
		
		//getField2(configs);
		configs = loadGridColumnModel(gxtComponentMetaNodeModel,configs,version);
		
		
		
			cm = new ColumnModel(configs);
		if (version == 1) {
			// 可编辑的表格
			employeeStore = getListStore();
			//employeeStore.getLoader().load();
//			EditorGrid<ModelData> grid = new EditorGrid<ModelData>(null, new ColumnModel(new ArrayList<ColumnConfig>()));
			EditorGrid<ModelData> grid = new EditorGrid<ModelData>(employeeStore, cm);
			GridSelectionModel<ModelData> sm = grid.getSelectionModel();
			sm.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {

				@Override
				public void selectionChanged(SelectionChangedEvent<ModelData> se) {
					System.err.println("????GridSelectionModel.addSelectionChangedListener...............");
				}
			});
			ModelData modelData = sm.getSelectedItem();
			List<ModelData> modelDatas = sm.getSelectedItems();
			List<ModelData> modelDatas2 =  sm.getSelection();
			//sm.setSelectionMode(SelectionMode.SINGLE)
			//grid.addListener(eventType, listener)
			addToolBar(contentPanel, grid);
			contentPanel.add(grid);
			//loader.load();
			return grid;
		}

		else if (version == 2) {
			// 分组表格
			//groupStore = getGroupStore(table);
			groupStore = new GroupingStore<ModelData>();
			System.err.println(configs);
			Grid<ModelData> grid = new Grid<ModelData>(groupStore, cm);
			grid.setData("gridType", 2);
			//grid.setData("groupingColumnId", XXX);其他地方实现
			contentPanel.add(grid);
			//loader.load();
			return grid;
			
		}
		else if (version == 3) {
			// 分页表格
//			pagingStore = getPaging2(gxtComponentMetaNodeModel, table);
			pagingStore =  new ListStore<ModelData>();
			System.err.println("$$$$$"+configs);
			final Grid<ModelData> grid = new Grid<ModelData>(pagingStore, cm);
			grid.setData("gridType", 3);
			contentPanel.add(grid);
			grid.setLoadMask(true);
			
			configurePagingGrid(grid ,gxtComponentMetaNodeModel);
			//pagingLoader.load();
			
			final PagingToolBar toolBar = new PagingToolBar(50);  
			toolBar.bind(pagingLoader);  
			contentPanel.setBottomComponent(toolBar);
			//Grid<BaseModel> gg= (Grid<BaseModel>)grid;
			
			
			return grid;
		}
		else if (version == 4) {
			// 可编辑分页表格
//			pagingStore = getPaging2(gxtComponentMetaNodeModel, table);
			pagingStore =  new ListStore<ModelData>();
			System.err.println("$$$$$"+configs);
			final EditorGrid<ModelData> grid = new EditorGrid<ModelData>(pagingStore, cm);
			grid.setData("gridType", 4);
			contentPanel.add(grid);
			grid.setLoadMask(true);
			
			configurePagingGrid(grid ,gxtComponentMetaNodeModel);
			//pagingLoader.load();
			
			final PagingToolBar toolBar = new PagingToolBar(50);  
			toolBar.bind(pagingLoader);  
			contentPanel.setBottomComponent(toolBar);
			//Grid<BaseModel> gg= (Grid<BaseModel>)grid;
			
			
			return grid;
		}
		else if (version == 5) {
			// 普通表格
			employeeStore = getListStore(table);
			Grid<ModelData> grid = new Grid<ModelData>(employeeStore, cm);
			contentPanel.add(grid);
			loader.load();
			return grid;
			Grid<ModelData> grid = new Grid<ModelData>(
					null, cm);
			//GridSelectionModel<ModelData> sm = new GridSelectionModel<ModelData>()
			//sm.setSelectionMode(SelectionMode.SINGLE)
			//grid.addListener(eventType, listener)
			contentPanel.add(grid);
			//loader.load();
			return grid;
		} else {
			return null;
		}

	}

	private static void configurePagingGrid(Grid grid,
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {
		//分页表格，设置页面大小	pageSize	
		if (gxtComponentMetaNodeModel.get(GridModelEnum.PAGESIZE.name()
				.toLowerCase()) != null) {		
			Integer pageSize = (Integer) gxtComponentMetaNodeModel
			.get(GridModelEnum.PAGESIZE.name().toLowerCase());
	
			grid.setData("pageSize", pageSize);
			
		}else {
			grid.setData("pageSize", 50);
		}
	}

	// 表格的字段
	private static List<ColumnConfig> loadGridColumnModel(GxtComponentMetaNodeModel gxtComponentMetaNodeModel,List<ColumnConfig> configs,int version) {
		//final GxtToSeamServiceParameter gxtToSeamServiceParameter = new GxtToSeamServiceParameter();

		List<SimpleComboBox<String>> simpleComboBoxs = new LinkedList<SimpleComboBox<String>>();
		SimpleComboBox<String> simpleComboBox =null;
		if(gxtComponentMetaNodeModel.get(AbstractComponetModelEnum.CHILDREN.name().toLowerCase())!=null){
			//添加子控件
		 List<GxtComponentMetaNodeModel> list =(List<GxtComponentMetaNodeModel>)gxtComponentMetaNodeModel.get(AbstractComponetModelEnum.CHILDREN.name().toLowerCase());
		
		 for(int i=0;i<list.size();i++)
			{
			 	
				simpleComboBox = SimpleComboBoxFactory.createSimpleComboBox(list.get(i));
				simpleComboBoxs.add(simpleComboBox);
			}			
		}
		
		//TODO 字段加载相关
		if (gxtComponentMetaNodeModel.get(GridModelEnum.COLUMNCONFIGLOAD.name()
				.toLowerCase()) != null) {
			Object object = gxtComponentMetaNodeModel
					.get(GridModelEnum.COLUMNCONFIGLOAD.name().toLowerCase());
			//grid.setData("columnConfigLoad", object);
			//ModelData modelData = result.getResult();
			List<BaseModel> baseModels = (List<BaseModel>)object;
										
			for (BaseModel baseModel : baseModels) {
				ColumnConfig columnConfig = new ColumnConfig();
				
				columnConfig.setHeader((String)baseModel.get("header"));
				if (baseModel.get("hidden")==null||!(Boolean)baseModel.get("hidden")) {
					columnConfig.setHidden(false);
				} else {
					columnConfig.setHidden(true);
				}
				columnConfig.setWidth((Integer)baseModel.get("width"));
				String columnConfig_id = (String)baseModel.get("id");
				columnConfig.setId(columnConfig_id);
				if (version==1||version==4) {
					if (simpleComboBoxs == null||simpleComboBoxs.size()==0) {
						columnConfig.setEditor(new CellEditor(new TextField<String>()));

					}else {
						for (SimpleComboBox box : simpleComboBoxs) {
//							if (box.getId().equals(columnConfig_id)) {
								if (box.getData("id").equals(columnConfig_id)) {
								final SimpleComboBox tempSimpleComboBox = box;
								CellEditor comboBoxCellEditor = getComboBoxCellEditor(tempSimpleComboBox);
								columnConfig.setEditor(comboBoxCellEditor);
								
								break;
							} else {								 
								columnConfig.setEditor(new CellEditor(new TextField<String>()));
							}
						}
						

					}
				} 
				
				configs.add(columnConfig);
			}
			
			

		}
		
		return configs;
	}

	private static List<ColumnConfig> getField2(List<ColumnConfig> configs) {
		// 实现可编辑的表格要在相应的字段上面添加celleditre的属性

		ColumnConfig columnConfig = new ColumnConfig();
		columnConfig.setId("name");
		columnConfig.setHeader("用户22名");
		columnConfig.setWidth(100);
		columnConfig.setEditor(new CellEditor(new TextField<String>()));
		configs.add(columnConfig);
		ColumnConfig columnConfig2 = new ColumnConfig();
		columnConfig2.setId("age");
		columnConfig2.setHeader("年22龄");
		columnConfig2.setWidth(100);
		columnConfig2.setEditor(new CellEditor(new TextField<String>()));
		columnConfig2.setRenderer(ageRender);
		configs.add(columnConfig2);
		
		// 分页表格对应的字段
		
		//  configs.add(new ColumnConfig("forum", "Forum", 150)); configs.add(new
		//  ColumnConfig("username", "Username", 100)); configs.add(new
		//  ColumnConfig("subject", "Subject", 200));
		
		// 分组表格对应的字段
		
		  ColumnConfig company = new ColumnConfig("name", "Company", 60);
		  ColumnConfig price = new ColumnConfig("open", "Price", 60);
		  ColumnConfig change = new ColumnConfig("change", "Change", 60);
		  ColumnConfig industry = new ColumnConfig("industry", "Industry", 60);
		  ColumnConfig last = new ColumnConfig("date", "Last Updated", 60);
		  last.setDateTimeFormat(DateTimeFormat.getFormat("MM/dd/y"));
		  
		  configs.add(company); configs.add(price); configs.add(change);
		  configs.add(industry); configs.add(last);
		 

		
		 

		// configs =
		// GridColumnConfigFactory.createColumnConfigList(loaderNumber,
		// ageRender,service);
		
		return configs;
	}

	
	// 普通表格的后台数据
	private static ListStore<ModelData> getListStore() {
		
		*//**
		 * 
		 * ServiceInvokerAsync serviceInvoker = GWT.create(ServiceInvoker.class);
		 * serviceInvoker.invokeService(className, serviceName, parameterList, callback);
		 * 传什么样的参数
		 * 调用哪个类的哪个方法
		 * 解析：
		 * 例如，想要查询人员列表，需要得到List<BaseModel>
		 * 就需要有类PersonService类，和listPerson方法
		 * 参数，暂时为空
		 * 
		 *//*
		ServiceInvokerAsync serviceInvoker = GWT.create(ServiceInvoker.class);
		serviceInvoker.invokeService("com.test.server.business.PersonService", "listPerson",new AsyncCallback<List<BaseModel>>() {
			
			@Override
			public void onSuccess(List<BaseModel> result) {
				System.out.println(result+"++++++++++++++++++++++");
				List<BaseModel> bmBaseModels= new LinkedList<BaseModel>();
				for (Object object : result) {
					bmBaseModels.add((BaseModel)object);
				}
				employeeStore.add((List<BaseModel>)bmBaseModels);
			}
			
			@Override
			public void onFailure(Throwable caught) {
				System.out.println("-----------------++++++++++++++++++++++");
				caught.printStackTrace();
			}
		});
		String moduleURL = GWT.getModuleBaseURL() + "invokeService";
		
		ServiceDefTarget endpoint = (ServiceDefTarget) serviceInvoker;
		endpoint.setServiceEntryPoint(moduleURL);
		proxy = new RpcProxy<List<BaseModel>>() {
			@Override
			protected void load(Object loadConfig,
					AsyncCallback<List<BaseModel>> callback) {
				//serviceInvoker.invokeService("com.test.server.business.PersonService", "listPerson", callback);
				//service.getBaseModle(table, callback);
			}
		};

		loader = new BaseListLoader<BaseListLoadResult<BaseModel>>(proxy);
		ListStore<ModelData> employeeStore = new ListStore<ModelData>(loader);
		// em	ployeeStore.add(TestData.getStocks());
		ageRender = new GridCellRenderer<BaseModel>() {
			@Override
			public Object render(BaseModel model, String property,
					com.extjs.gxt.ui.client.widget.grid.ColumnData config,
					int rowIndex, int colIndex, ListStore<BaseModel> store,
					Grid<BaseModel> grid) {
				return null;
			}
		};
		employeeStore.getLoader().load();
		return employeeStore;
	}

	// 分组表格的后台数据
	private static GroupingStore<ModelData> getGroupStore(final String table) {
		RpcProxy<List<ModelData>> proxy = new RpcProxy<List<ModelData>>() {
			@Override
			protected void load(Object loadConfig,
					AsyncCallback<List<ModelData>> callback) {
				service.getGroupModle(table, callback);
			}
		};
		loader = new BaseListLoader<BaseListLoadResult<BaseModel>>(proxy);
		GroupingStore<ModelData> store = new GroupingStore<ModelData>(loader);
		// store.add(Text.getCompanies());
		store.groupBy("industry");
		store.getLoader().load();
		return store;
	}



	
	
	// 分页表格的后台数据
	private static ListStore<ModelData> getPaging2(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel,
			final String table) {
		RpcProxy<PagingLoadResult<ModelData>> proxy = new RpcProxy<PagingLoadResult<ModelData>>() {
			@Override
			protected void load(Object loadConfig,
					AsyncCallback<PagingLoadResult<ModelData>> callback) {
				//service.getPageGrid(table, (PagingLoadConfig) loadConfig,callback);
			}
		};

		pagingLoader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy);
		pagingLoader.setRemoteSort(true);

		ListStore<ModelData> store = new ListStore<ModelData>(pagingLoader);

		// 需要把toolbar加到面板上
		PagingToolBar toolBar = new PagingToolBar(45);  

		toolBar.bind(pagingLoader);
		toolBar.setShowToolTips(true);
		contentPanel.setBottomComponent(toolBar);
		store.getLoader().load();
		return store;
	}
	
	private static void addToolBar(ContentPanel cp,final Grid<ModelData> grid) {
		ToolBar toolBar = new ToolBar();   
	    //toolBar.getAriaSupport().setLabel("Grid Options");   
	    //toolBar.add(new Button());
	    Button add = new Button("Add a Row", Resources.ICONS.add(),new SelectionListener<ButtonEvent>() {   
	        @Override   
	        public void componentSelected(ButtonEvent ce) {   
	          grid.getStore().insert(new BaseModel(), grid.getStore().getCount());   
	         
	        }   
	    
	      });   
	    Button delete = new Button("Delete a Row", Resources.ICONS.delete(),new SelectionListener<ButtonEvent>() {   
	        @Override   
	        public void componentSelected(ButtonEvent ce) {  
	        	 ce.getComponent().disable();   
	          grid.getStore().remove(grid.getStore().getAt(0));   
	          if (grid.getStore().getCount() == 0) {   
	            ce.getComponent().disable();   
	          }   
	        }   
	    
	      });   
	    toolBar.add(add);   
	    toolBar.add(new SeparatorToolItem());   
	    //toolBar.add(delete);   
	    //toolBar.add(new SeparatorToolItem());   
	    //toolBar.add(new Button("Configure", Resources.ICONS.plugin()));   
	    cp.setTopComponent(toolBar);   
	    //cp.add(grid);
	}
	
	
	private static CellEditor getComboBoxCellEditor(final SimpleComboBox<String> combo) {
		
		final SimpleComboBox<String> combo = new SimpleComboBox<String>();   
	    combo.setForceSelection(true);   
	    //combo.setTriggerAction(TriggerAction.ALL);   
	    combo.add("Shade");   
	    combo.add("Mostly Shady");   
	    combo.add("Sun or Shade");   
	    combo.add("Mostly Sunny");   
	    combo.add("Sunny");   
	    
	  
	    CellEditor editor = new CellEditor(combo) {   
	      @Override   
	      public Object preProcessValue(Object value) {   
	        if (value == null) {   
	          return value;   
	        }   
	        return combo.findModel(value.toString());   
	      }   
	  
	      @Override   
	      public Object postProcessValue(Object value) {   
	        if (value == null) {   
	          return value;   
	        }   
	        return ((ModelData) value).get("value");   
	      }   
	    };   
	    
	    return editor;
		
	}


}*/
